﻿@model sBlog.Net.Models.PostModel

<div class="post">
    @{
        var url = Url.RouteUrl("IndividualPost", new { year = Model.Post.PostYear, month = Model.Post.PostMonth, url = Model.Post.PostUrl, status = string.Empty });
    }
    <h2 class="title"><a href="@url">@Model.Post.PostTitle</a></h2>
    <p class="meta">
        <span class="date">@Model.Post.PostAddedDate.ToLongDateString()</span>
        <span class="posted" style="float: right;">@ViewRes.SharedStrings.PostedByStr <b>@Html.ActionLink(Model.Post.OwnerUserName, "PostsByAuthor", "Author", new { authorName = Model.Post.UserName }, new { })</b> @ViewRes.SharedStrings.UnderStr @Html.Partial("PostCategories", Model.Post.Categories)</span>
    </p>
    <div class="entry" style="border-bottom: 1px solid #3A3D3F;">
        <div style="border-bottom: 1px solid #3A3D3F;">
            @Html.Raw(Model.PostTitle)
            @{
                var count = Model.Post.Comments != null ? Model.Post.Comments.Count : 0;
            }
        </div>
        <a style="float:right;border:1px solid #3A3D3F; margin-top:11px;padding-left:10px;padding-right:10px" href="@url">Читать дальше</a>
	    <p class="meta">
            @ViewRes.SharedStrings.TaggedStr @Html.Partial("PostTags", Model.Post.Tags)
            @* ReSharper disable AssignNullToNotNullAttribute *@
            @if (!Model.DisqusEnabled)
            {
                <span class="posted"><a href="@(url + "#user-comments")">@ViewRes.SharedStrings.CommentsStr</a>&nbsp @count</span>
            }
            else
            {
                var fullyQualifiedUrl = Model.RootUrl.IndexOf(url, System.StringComparison.Ordinal) >= 0 ? string.Format("{0}#disqus_thread", Model.RootUrl) : string.Format("{0}{1}#disqus_thread", Model.RootUrl, url);
                <span class="posted"><a href="@fullyQualifiedUrl" data-disqus-identifier="@url">Link</a></span>
            }
            @* ReSharper restore AssignNullToNotNullAttribute *@
	    </p>
    </div>
</div>
